package edu.demo.recommend.service.impl;

import edu.demo.recommend.pojo.Seller;
import edu.demo.recommend.service.SellerService;
import edu.demo.recommend.mapper.SellerMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author hb
 */
@Service
public class SellerServiceImpl implements SellerService {
    @Resource //不推荐使用Autowired推荐使用Resource
    private SellerMapper sellerMapper;
    @Override
    public List<Seller> selectAll() {
        return sellerMapper.selectAll();
    }

    @Override
    public Seller create(Seller seller) {
        seller.setDisabledFlag(0);
        //设置默认的评分
        seller.setRemarkScore(new BigDecimal(0));
        sellerMapper.insertSelective(seller);
        return seller;
    }

    @Override
    public Seller findById(Integer id) {
        return sellerMapper.selectByPrimaryKey(id);
    }


}
